// -*- coding: utf-8 -*- 
/**
 * Project: AlgorithmsLearn
 *
 * @author: yanking
 * Create time: 2022-04-13 17:21
 * IDE: IntelliJ IDEA
 * Introduction:
 */
package com.LeetCodeT.Intervalsummation;

import java.util.TreeMap;

public class isCoverTT {
    public boolean isCovered(int[][] ranges, int left, int right) {
        TreeMap<Integer, Integer> map = new TreeMap<>();
        for (int[] range : ranges) {
            map.put(range[0], range[1]);
        }
        Integer l = map.floorKey(left);
        if (l == null) {
            return false;
        }
        return map.get(l) > right;
    }
    public static void main(String[] args) {
        //int[][] ranges = {{1, 2}};
        int[][] ranges = {{1, 2}, {3, 4}, {5, 6}};
        //int[][] ranges = {{1, 10}, {10, 20}};
        int left = 2, right = 5;
        isCoverTT ic = new isCoverTT();
        System.out.println(ic.isCovered(ranges, left, right));
    }

}
